Unit BDojoJsonRestUnit;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils, BDojoSessionUnit, BDojoStoreUnit;

Type

{ BDojoJsonRestClass }

 BDojoJsonRestClass = Class(BDojoStoreClass)
  Private
    bIDProperty: String;
    bTarget: String;
    Procedure SetIDProperty(aValue: String);
    Procedure SetTarget(aValue: String);
  Public
    //** Indicates the property to use as the identity property.
    //** The values of this property should be unique.
    Property IDProperty: String Read bIDProperty Write SetIDProperty;
    //** The target base URL to use for all requests to the server. This string
    //** will be prepended to the id to generate the URL (relative or absolute)
    //** for requests sent to the server
    Property Target: String Read bTarget Write SetTarget;

    Constructor Build(Const aSession: BDojoSessionClass;
      Const aJSType: String = ''); override;
End;

Implementation

{ BDojoJsonRestClass }

Procedure BDojoJsonRestClass.SetIDProperty(aValue: String);
Begin
  bIDProperty := aValue;
  SetConfig('idProperty', aValue);
End;

Procedure BDojoJsonRestClass.SetTarget(aValue: String);
Begin
  bTarget := aValue;
  SetConfig('target', aValue, FALSE);
End;

Constructor BDojoJsonRestClass.Build(Const aSession: BDojoSessionClass;
  Const aJSType: String);
Begin
  If aJSType = '' Then Inherited Build(aSession, 'dojo.store.JsonRest')
  Else Inherited Build(aSession, aJSType)
End;

End.

